]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Disconnect destroy signal handler when needed
authorRay Strode <rstrode@redhat.com>
Tue, 6 Oct 2020 14:29:00 +0000 (10:29 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 7 Oct 2020 21:03:52 +0000 (17:03 -0400)
The panel corners try to match their style to the buttons closest
to them. In order to make sure the corner styles stay in sync with
their neighboring buttons, they connect to the style-changed signals
of the buttons.

In order to make sure the style-changed signal handler isn't leaked,
it gets disconnected when the button is destroyed.

Unfortunately, the destroy signal handler connection itself gets leaked!

This commit ensures the destroy signal handler gets disconnected any
time the neighboring button is re-determined.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1460

js/ui/panel.js

index b168907def8421a3c4df2261a6fb1c12107ff84f..272368a4b076a9e25b3b6fdad8a18f18c15d53a2 100644 (file)
@@ -591,14 +591,19 @@ class PanelCorner extends St.DrawingArea {
             button = this._findRightmostButton(box);
 
         if (button) {
-            if (this._button && this._buttonStyleChangedSignalId) {
-                this._button.disconnect(this._buttonStyleChangedSignalId);
-                this._button.style = null;
+            if (this._button) {
+                if (this._buttonStyleChangedSignalId) {
+                    this._button.disconnect(this._buttonStyleChangedSignalId);
+                    this._button.style = null;
+                }
+
+                if (this._buttonDestroySignalId)
+                    this._button.disconnect(this._buttonDestroySignalId);
             }
 
             this._button = button;
 
-            button.connect('destroy', () => {
+            this._buttonDestroySignalId = button.connect('destroy', () => {
                 if (this._button == button) {
                     this._button = null;
                     this._buttonStyleChangedSignalId = 0;